function fig7_14

%  this requires files:  radau.m, rdpget.m, and rdpset.m

global lam
clf

lam=20;
ep=1/lam
t1=1.5-log(2)
t2=t1+2.33811*ep^(4/3)

clf
% get(gcf)
set(gcf,'Position', [25 1115 658 230])
subaxis(1,1,1,1,'MT',0.01,'MB',0.2,'MR',-0.015,'ML',0.038,'P',0.04)

na=100;
yc=linspace(1,2,na);
for i=1:na
    tc(i)=log(yc(i)/2)-0.5*yc(i)^2+2;
end

%  initial values
tmax=1.5-log(2)+0.1
% y10=2+(2/9)*ep; y20=-2/3;
% y0=[y10 y20];
% calculate solution using a MATLAB routine
%options = odeset('RelTol', 1e-12,'AbsTol',1e-12,'Jacobian',@(t,y) [lam^2*(1-y(1)^2) -lam^2;1  0]);
%[t,y] = ode45(@rhs,[0 tmax],y0,options);
%[t,y] = ode23s(@rhs,[0 tmax],y0,options);
y10=2+(2/9)*ep^2; y20=-2/3;
y0=[y10; y20];
tspan = [0 tmax];
options = rdpset('RelTol',1e-14,'AbsTol',1e-16);
[t,y] = radau(@Deriv,tspan,y0,options);
length(t)

hold on
plot(tc,yc,'b','LineWidth',1.2)
plot(t,y(:,1),'--r','LineWidth',1.2)

set(gca,'ytick',[-2 -1 0 1])
set(gca,'YTickLabel',{'$-2$';'$-1$';'0';'1'})

ax = gca;
ax.XAxis.TickLabelInterpreter = 'latex';
ax.YAxis.TickLabelInterpreter = 'latex';
set(gca,'FontSize',13)

xlabel('$\tau$\,-\,axis','Interpreter','latex','FontSize',14)
ylabel('$y$\,-\,axis','Interpreter','latex','FontSize',14)
grid on

box on


na=100;
tau1=1.5-log(2);
tau=linspace(tau1-0.05,tau1+0.0425,na);
for i=1:na
    tauC(i)=(tau(i)-tau1)/ep^(4/3);
    yC(i)=1-ep^(2/3)*airy(1,-tauC(i))/airy(-tauC(i));
end
plot(tau,yC,'color',[0 0.5 0],'LineWidth',1.2)

%axis([0 0.9 -2.4 2.4])
axis([0.7 0.88 -2.4 1.5])
legend({' Outer',' Numerical ',' Corner'},'Location','SouthWest')

%exportgraphics(gcf,'/Users/mark/Desktop/van3.pdf')

hold off

%  define f(t,y)
%function dy=rhs(t,y)
function dy = Deriv(t, y)
global lam
dy=[lam^2*(y(1)*(1-y(1)^2/3)-y(2)); y(1)];
% dy=zeros(2,1);
% dy(1) = lam^2*(y(1)*(1-y(1)^2/3)-y(2));
% dy(2) = y(1);






